package com.lovo.redis.util;

import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;

import java.nio.charset.Charset;


public class SysBloomFilter {
    public  static BloomFilter bloomFilter;
    static {
        //布隆过滤器,,实现项目中可以在用户添加数据或修改数据的时候放入数据
        bloomFilter= BloomFilter.create(Funnels.stringFunnel(Charset.defaultCharset()),1000000,0.001);
        bloomFilter.put("黑客帝国");
        bloomFilter.put("88.0");
        bloomFilter.put("91.0");
        bloomFilter.put("92.0");
    }

    public static void main(String[] args) {
    boolean bl=    SysBloomFilter.bloomFilter.mightContain("黑客帝国");
        System.out.println(bl);
    }
}
